package com.ymatou.iapi.godmch.service;

import org.json.JSONException;
import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;

public class GetEffectExchangeRateCall extends YmatouBaseCall{

private static String opurl ="api/exchangerate/getEffectExchangeRate";
	
	public GetEffectExchangeRateCall() {
//		super(EnvSetup.getSystemUrl("godmch_iapi"), opurl, "POST", "JSON");
		super("http://godmch.iapi.shop2cn.com/", opurl, "POST", "JSON");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept",
				"text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	public Double getExchangeRate() throws JSONException {
		return new JSONObject(getString("result").toString())
				.getJSONArray("list").getJSONObject(0)
				.getDouble("exchangeRate");
	}
}
